package com.tengju.settlement.infrastructure.repository.convert;

import com.tengju.settlement.domain.model.AgreementConfirm;
import com.tengju.settlement.infrastructure.persistence.mybatis.dataobject.AgreementConfirmDO;

import java.sql.Date;
import java.time.ZoneId;

public class AgreementConfirmConvert {

    public static AgreementConfirmDO convert(AgreementConfirm agreementConfirm) {
        AgreementConfirmDO agreementConfirmDO = new AgreementConfirmDO();
        agreementConfirmDO.setIdCode(agreementConfirm.getIdCode().getValue());
        agreementConfirmDO.setType(agreementConfirm.getType());
        agreementConfirmDO.setConfirmTime(Date.from(agreementConfirm.getConfirmTime().atZone(ZoneId.systemDefault()).toInstant()));
        return agreementConfirmDO;
    }
}
